{% extends 'view_file_base.html' %}
{% load i18n %}

{% block edit_file %}
{% if user_perm == 'rw' and not err%}
<button data="{{ SITE_ROOT }}repo/{{ repo.id }}/file/edit/?p={{ path|urlencode }}&file_enc={{file_enc}}" id="edit">{% trans "Edit"%}</button>
{% endif %}
{% endblock %}

{% block file_view %}
    {% if encoding != None %}
    <div id="file-enc-cont">
        <label for="file-enc">{% trans "Encoding:" %}</label>
        <select id="file-enc">
            {% for enc in file_encoding_list %}
            <option value="{{ enc }}" {% if encoding and encoding == enc %} selected="selected" {% endif %}>{% if enc == 'auto'%}{% trans "auto detect" %}{% else %}{{ enc }}{% endif %}</option>
            {% endfor %}
        </select>
    </div>
    {% endif %}

    {% ifnotequal file_content None %}
    <div id="sf" class="article"></div>
    {% endifnotequal %}
{% endblock %}

{% block extra_script %}{{ block.super }}
<script type="text/javascript">
{% ifnotequal file_content None %}
{% include 'snippets/xss.html' %}
$('#sf').html(cleanHtmlForXss('{{file_content|escapejs}}'));
{% endifnotequal %}
</script>
{% endblock%}
